<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>管理员列表-<?php echo $cfg_sitename."-".$cfg_sysversion;?></title>
<meta property="xn:admins" content="583870616"/>
<meta property="wb:webmaster" content="ye-shi-li@qq.com">
<link href="templets/css/admin_css.css" rel="stylesheet" type="text/css" />
</head>
<script>
function checkreg()
{
if (document.myform.rankadmin.value=="") {
	window.alert("管理权限不能为空！！");
	document.myform.rankadmin.focus();		
	 return (false);
	}
if (document.myform.username.value=="") {
	window.alert("用户名不能为空！！");
	document.myform.username.focus();		
	 return (false);
	}
<?php if($act == "mod"){?>
if (document.myform.pass.value=="") {
	window.alert("修改资料原始密码不能为空！！");
	document.myform.pass.focus();		
	 return (false);
	}
<?php }?>
if (document.myform.password.value=="") {
	window.alert("密码不能为空！！");
	document.myform.password.focus();		
	 return (false);
	}
if (document.myform.password1.value==""){
	window.alert("新密码不能为空!!");
	document.myform.password1.focus();		
	return (false);
	}
if (document.myform.password.value!=document.myform.password1.value){
	window.alert("两次输入的密码不一样!!");
	document.myform.password.focus();
	document.myform.password1.value=="";	
	return (false);
}
if (document.myform.name.value==""){
	window.alert("姓名不能为空!!");
	document.myform.name.focus();		
	return (false);
	}
	return true;
}
</script>
</head>
<body>
<?php
if($act == "add"){
?>
<table width="98%" height="101" border="0" cellpadding="3" cellspacing="1" class="ye">
  <form name="myform" action="admin_admin_ok.php?act=add" method="post" onSubmit="return checkreg();">
    <tr>
      <td height="22" colspan="2" bgcolor="#555555"><font color="#FFFFFF">&nbsp;<strong>管理员添加</strong></font></td>
    </tr>
    <tr>
      <td width="13%" height="24" align="right" valign="middle" bgcolor="#f8f8f8">管理权限：</td>
      <td width="87%" height="24" align="left" valign="middle" bgcolor="#f8f8f8"><select class="select" name="rankadmin" id="rankadmin">
       <option value="">--请选择--</option>
       <option value="1">超级管理员</option>
       <option value="2">普通管理员</option>
      </select></td>
    </tr>
    <tr>
      <td width="13%" height="24" align="right" valign="middle" bgcolor="#f8f8f8">用户名：</td>
      <td width="87%" height="24" align="left" valign="middle" bgcolor="#f8f8f8"><input name="username" type="text" id="username" size="50" value="" class="yeshili"/></td>
    </tr>
    <tr>
      <td width="13%" height="24" align="right" valign="middle" bgcolor="#f8f8f8">请输入密码：</td>
      <td width="87%" height="24" align="left" valign="middle" bgcolor="#f8f8f8"><input name="password" type="password" id="password" size="50" value="" class="yeshili"/></td>
    </tr>
    <tr>
      <td width="13%" height="24" align="right" valign="middle" bgcolor="#f8f8f8">请再次输入密码：</td>
      <td width="87%" height="24" align="left" valign="middle" bgcolor="#f8f8f8"><input name="password1" type="password" id="password1" value=""  size="50" class="yeshili"/>
      </td>
    </tr>
    <tr>
      <td width="13%" height="24" align="right" valign="middle" bgcolor="#f8f8f8">姓名：</td>
      <td width="87%" height="24" align="left" valign="middle" bgcolor="#f8f8f8"><input name="name" type="text" id="name" size="50" value="" class="yeshili"/></td>
    </tr>
    <tr>
      <td width="13%" height="24" align="right" valign="middle" bgcolor="#f8f8f8">联系手机：</td>
      <td width="87%" height="24" align="left" valign="middle" bgcolor="#f8f8f8"><input name="tel" type="text" id="tel" size="50" value="" class="yeshili"/></td>
    </tr>
    <tr>
      <td width="13%" height="24" align="right" valign="middle" bgcolor="#f8f8f8">联系QQ：</td>
      <td width="87%" height="24" align="left" valign="middle" bgcolor="#f8f8f8"><input name="qq" type="text" id="qq" size="50" value="" class="yeshili"/></td>
    </tr>
    <tr>
      <td width="13%" height="24" align="right" valign="middle" bgcolor="#f8f8f8">联系微信：</td>
      <td width="87%" height="24" align="left" valign="middle" bgcolor="#f8f8f8"><input name="weixin" type="text" id="weixin" size="50" value="" class="yeshili"/></td>
    </tr>
    <tr>
      <td width="13%" height="24" align="right" valign="middle" bgcolor="#f8f8f8">备注：</td>
      <td width="87%" height="24" align="left" valign="middle" bgcolor="#f8f8f8"><textarea name="content" id="content" class="textarea"></textarea></td>
    </tr>
    <tr>
      <td height="24" bgcolor="#f8f8f8">&nbsp;</td>
      <td height="24" bgcolor="#f8f8f8"><input type="submit" name="button" id="button" value="提交" class="button"/> <input type="button" name="back" id="back" value="返回" onclick="javascript:window.history.go(-1);" class="button"/></td>
    </tr>
  </form>
</table>
<?php
}
?>
<?php
if($act == "mod"){
	$sql = get_sql("select * from {pre}admin where id=".$id);
	$list = $db->getonerow($sql);
?>
<table width="98%" height="101" border="0" cellpadding="3" cellspacing="1" class="ye">
  <form name="myform" action="admin_admin_ok.php?act=mod" method="POST" onSubmit="return checkreg();">
    <tr>
      <td height="24" colspan="2" bgcolor="#555555"><font color="#FFFFFF">&nbsp;<strong>管理员修改</strong></font></td>
    </tr>
    <tr>
      <td width="13%" height="24" align="right" valign="middle" bgcolor="#f8f8f8">管理权限：</td>
      <td width="87%" height="24" align="left" valign="middle" bgcolor="#f8f8f8"><select class="select" name="rankadmin" id="rankadmin">
       <?php if($list['rankadmin']==1){
         $v=1;
         $n='超级管理员';
        }
        else if($list['rankadmin']==2){
         $v=2;
         $n='普通管理员';
        }
        else{
         $v='';
         $n='--请选择--';
        }
       echo '<option value="'.$v.'">'.$n.'</option>';
       ?>
       <option value="1">超级管理员</option>
       <option value="2">普通管理员</option>
      </select></td>
    </tr>
    <tr>
      <td width="13%" height="24" align="right" valign="middle" bgcolor="#f8f8f8">用户名：</td>
      <td width="87%" height="24" align="left" valign="middle" bgcolor="#f8f8f8"><?php echo $list['username']; ?></td>
    </tr>
    <tr>
      <td width="13%" height="24" align="right" valign="middle" bgcolor="#f8f8f8">原始密码：</td>
      <td width="87%" height="24" align="left" valign="middle" bgcolor="#f8f8f8"><input name="pass" type="password" id="pass" value="" size="50" class="yeshili"/></td>
    </tr>
    <tr>
      <td width="13%" height="24" align="right" valign="middle" bgcolor="#f8f8f8">请输入密码：</td>
      <td width="87%" height="24" align="left" valign="middle" bgcolor="#f8f8f8"><input name="password" type="password" id="password" onblur="if(this.value==''){this.value='<?php echo $list['password']; ?>';}" onclick="if(this.value='<?php echo $list['password']; ?>'){this.value='';}" value="<?php echo $list['password']; ?>" onfocus="if(this.value='<?php echo $list['password']; ?>'){this.value='';}" size="50" class="yeshili"/> 密码不填写不修改！</td>
    </tr>
    <tr>
      <td width="13%" height="24" align="right" valign="middle" bgcolor="#f8f8f8">请再次输入密码：</td>
      <td width="87%" height="24" align="left" valign="middle" bgcolor="#f8f8f8"><input name="password1" type="password" id="password1" onblur="if(this.value==''){this.value='<?php echo $list['password']; ?>';}" onclick="if(this.value='<?php echo $list['password']; ?>'){this.value='';}" value="<?php echo $list['password']; ?>" onfocus="if(this.value='<?php echo $list['password']; ?>'){this.value='';}" size="50" class="yeshili"/>
      </td>
    </tr>
    <tr>
      <td width="13%" height="24" align="right" valign="middle" bgcolor="#f8f8f8">姓名：</td>
      <td width="87%" height="24" align="left" valign="middle" bgcolor="#f8f8f8"><input name="name" type="text" id="name" size="50" value="<?php echo $list['name']; ?>" class="yeshili"/></td>
    </tr>
    <tr>
      <td width="13%" height="24" align="right" valign="middle" bgcolor="#f8f8f8">联系手机：</td>
      <td width="87%" height="24" align="left" valign="middle" bgcolor="#f8f8f8"><input name="tel" type="text" id="tel" size="50" value="<?php echo $list['tel']; ?>" class="yeshili"/></td>
    </tr>
    <tr>
      <td width="13%" height="24" align="right" valign="middle" bgcolor="#f8f8f8">联系QQ：</td>
      <td width="87%" height="24" align="left" valign="middle" bgcolor="#f8f8f8"><input name="qq" type="text" id="qq" size="50" value="<?php echo $list['qq']; ?>" class="yeshili"/></td>
    </tr>
    <tr>
      <td width="13%" height="24" align="right" valign="middle" bgcolor="#f8f8f8">联系微信：</td>
      <td width="87%" height="24" align="left" valign="middle" bgcolor="#f8f8f8"><input name="weixin" type="text" id="weixin" size="50" value="<?php echo $list['weixin']; ?>" class="yeshili"/></td>
    </tr>
    <tr>
      <td width="13%" height="24" align="right" valign="middle" bgcolor="#f8f8f8">备注：</td>
      <td width="87%" height="24" align="left" valign="middle" bgcolor="#f8f8f8"><textarea name="content" id="content" class="textarea"><?php echo $list['content']; ?></textarea></td>
    </tr>
    <tr>
      <td height="24" bgcolor="#f8f8f8">&nbsp;</td>
      <td height="24" bgcolor="#f8f8f8"><input name="username" type="hidden" id="username" value="<?php echo $list['username']; ?>" class="yeshili"/><input type="hidden" name="id" value="<?php echo $list['id']; ?>">
        <input type="submit" name="button" id="button" value="提交" class="button"/> <input type="button" name="back" id="back" value="返回" onclick="javascript:window.history.go(-1);" class="button"/></td>
    </tr>
  </form>
</table>
<?php
}
?>
</body>
</html>